$(function () {
    var signin_datagrid = $("#signin_datagrid");
    signin_datagrid.datagrid({
        url: "/signin/list",
        fit: true,
        columns: [[
            {field: 'x', checkbox: true},
            // {field:'id',title:'id',width:100,hidden:true}, //hidden 隐藏显示该列
            {
                field: 'realname', title: '真实名字', width: 100, formatter: function (value, row, index) {
                return row.employees.realname;
            }
            },//允许列改变大小
            {
                field: 'detpName', title: '所属部门', width: 100, formatter: function (value, row, index) {
                return row.employees.dept.name;
            }
            },
            {field: 'indate', title: '签到时间', width: 100},
            {field: 'outdate', title: '退签时间', width: 100, formatter: function (value, row, index) {
                if (value == null) {
                    return "<font color='red'>未签退</font>";
                } else{
                    return value;
                }
            }},
            {
                field: 'status', title: '考勤状态', width: 100, formatter: function (value, row, index) {
                if (value == 1) {
                    return "<font color='green'>已签到</font>";
                } else if (value == 2) {
                    return "<font color='red'>已退签</font>";
                }
            }
            }
        ]],
        rownumbers: true,
        striped: true,
        toolbar: "#signin_toolbar",
        pagination: true,
        fitColumns: true
    })

    $("#query").click(function () {
        var kw = $("#realname").textbox("getValue");
        var beginDate = $("#beginDate").textbox("getValue");
        var endDate = $("#endDate").textbox("getValue");
        console.log(kw);
        signin_datagrid.datagrid('load',{
            realname:kw,
            beginDate:beginDate,
            endDate:endDate,
        });
    })


})











